home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / pcxstrm.h < prev    next >
C/C++ Source or Header  |  1994-10-10  |  587b  |  32 lines

  1. #ifndef __PCX_STREAM__
  2. #define __PCX_STREAM__
  3.  
  4. #include <stdio.h>
  5. #include <Simple.h>
  6.  
  7. const BUFFER_LENGTH = 1024;
  8.  
  9. class pcxstream
  10.     {
  11.     public:
  12.     pcxstream(FILE * f);
  13.     bool isValid() { return buffer != 0; }
  14.     void read(unsigned char * dest, int n);
  15.     int pcxstream::get()
  16.         {
  17.         if(pos == BUFFER_LENGTH)
  18.         {
  19.         fread(buffer, 1, BUFFER_LENGTH, file);
  20.         pos = 0;
  21.         }
  22.         return buffer[pos++];
  23.         }                               // read char
  24.     ~pcxstream();
  25.  
  26.  
  27.     private:
  28.     unsigned char * buffer;
  29.     int pos;
  30.     FILE * file;
  31.     };
  32. #endif __PCX_STREAM__